package com.example.myapplication.module1.adapter

import android.content.Context
import android.view.LayoutInflater
import android.view.ViewGroup
import com.example.myapplication.databinding.ItemPlanBinding
import com.example.myapplication.entity.AppointmentVisitBean
import com.example.mylibrary.adapter.BaseRecyclerAdapter

class AppointmentVisitAdapter(context: Context) : BaseRecyclerAdapter<ItemPlanBinding>(context) {

    var appointmentVisitBeanList = mutableListOf<AppointmentVisitBean>()
        set(value) {
            field = value
            notifyDataSetChanged()
        }

    override fun getBinding(
        inflater: LayoutInflater,
        parent: ViewGroup,
        viewType: Int
    ): ItemPlanBinding {
        return ItemPlanBinding.inflate(inflater, parent, false)
    }

    override fun bindHolder(holder: BaseViewHolder, position: Int) {
        val appointmentVisitBean = appointmentVisitBeanList[position]
        viewBinding.tvNum.text = "${position + 1}"
        viewBinding.tvPlanName.text = appointmentVisitBean.cname
        viewBinding.tvPlanStartDate.text = appointmentVisitBean.lxrname
        viewBinding.tvPlanEndDate.text = appointmentVisitBean.typesname
    }

    override fun getItemCount(): Int {
        return appointmentVisitBeanList.size
    }
}
